- /* sifbfact.cpp by K.Tsuru */
- // function ID 4102 BRADIX
- /*******************************************************
- SInteger class
- It provides the factorial n! using the primitive method.
- See BdFact().
- ********************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- SInteger BFact(ulong n){
- long fig = long( (double)Stirling(n)/log10((double)BRADIX) )+1;//the number of figures in BRADIX ver. 2.17
- if(fig >= (long)SNManager::SNMaxSize(SNManager::BIN_INT)){
- SNManager::SetError(SNManager::OUT_OF_RANGE, "BFact", 4102);
- }
- SInteger m((uint)fig, 1); // m = 1, allocates the memory
- if(n < 2uL) return m;
-
- ulong i;
- for(i = 2uL; i <= n; i++) IsMult(m, i, m);
-
- return m;
- }
sifbfact.cpp : last modifiled at 2015/12/05 20:12:13(730 bytes)
created at 2016/04/25 14:53:17
The creation time of this html file is 2017/10/25 11:09:45 (Wed Oct 25 11:09:45 2017).